home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
sos3-2.lha
/
src
/
agg
/
Mapping.h
< prev
next >
Wrap
C/C++ Source or Header
|
1992-01-23
|
3KB
|
82 lines
/* --------------------------------------------------------------------------
* Copyright 1992 by Forschungszentrum Informatik (FZI)
*
* You can use and distribute this software under the terms of the licence
* you should have received along with this program.
* If not or if you want additional information, write to
* Forschungszentrum Informatik, "STONE", Haid-und-Neu-Strasse 10-14,
* D-7500 Karlsruhe 1, Germany.
* --------------------------------------------------------------------------
*/
#ifndef MAPPINGH
#define MAPPINGH 1
#include "knl_use.h"
// MAX_PAGE_SIZE regelt die Groesse einer Seite, als tatsaechliche
// Seitengroesse wird die groesstmoegliche Zahl < MAX_PAGE_SIZE benutzt.
// Auf eine Seite muessen mindestens 3 Eintraege passen !!!
// Daher MAX_PAGE_SIZE >= 216 (falls Listenversion)
const sos_Int MAX_PAGE_SIZE = 1024;
// Der Datentyp object_save_t wird als sos_typed_id abgespeichert
union object_save_t {sos_Typed_id dummy; char c[SOS_TYPED_ID_SIZE];};
typedef struct ht_entry_t
{ sos_Offset page_list_offset;
sos_Char local_depth;
};
typedef struct entry_t
{ sos_Int hash_value;
object_save_t key;
object_save_t info;
};
typedef struct list_t
{ object_save_t pred;
object_save_t succ;
};
typedef struct page_header_t
{ sos_Char pages;
sos_Char entries_on_last_page;
sos_Offset next_page;
};
const sos_Int PAGE_HEADER_SIZE = SOS_OFFSET_SIZE + 2*CHAR_SIZE;
const sos_Int ENTRY_SIZE = INT_SIZE + 2*SOS_TYPED_ID_SIZE;
const sos_Int HT_ENTRY_SIZE = SOS_OFFSET_SIZE + CHAR_SIZE;
const sos_Int LIST_SIZE = 2*SOS_TYPED_ID_SIZE;
const sos_Int max_page_entries_with_list =
(MAX_PAGE_SIZE - PAGE_HEADER_SIZE)/(ENTRY_SIZE+LIST_SIZE);
const sos_Int max_page_entries_without_list=
(MAX_PAGE_SIZE - PAGE_HEADER_SIZE)/ENTRY_SIZE;
const sos_Int add_list_pos = PAGE_HEADER_SIZE+
ENTRY_SIZE*max_page_entries_with_list;
typedef struct page_t
{ page_header_t page_header;
entry_t entry[max_page_entries_without_list];
list_t list[max_page_entries_without_list];
};
const page_size_with_list = PAGE_HEADER_SIZE+
max_page_entries_with_list* (ENTRY_SIZE+LIST_SIZE);
const page_size_without_list = PAGE_HEADER_SIZE+
max_page_entries_without_list * ENTRY_SIZE;
// maximale globale Tiefe, eine rein akademische Groesse,
// da vorher eh die Platte platzt
const MAX_GLOBAL_DEPTH = 20;
// Groesse des Feldes, in dem die Anzahlen der Seitenlisten
// mit einer bestimmten lokalen Tiefe gespeichert sind:
const NO_OF_PAGES_ARRAY_SIZE = INT_SIZE*MAX_GLOBAL_DEPTH;
#endif